package org.example.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.example.pojo.MedicalTechnology;
import org.example.query.MedicalRecordQuery;
import org.example.service.IMedicalTechnologyService;
import org.example.vo.ResultBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author peak
 * @since 2024-12-18
 */
@RestController
@RequestMapping("/medicaltech")
public class MedicalTechnologyController extends BaseController<MedicalTechnology, MedicalRecordQuery> {
    //模糊搜索
    //根据前端输入搜索检查的类型
    @Autowired
    private IMedicalTechnologyService medicalTechnologyService;
    @GetMapping("/type/{type}/{name}")
    public ResultBean type(@PathVariable("type")String type, @PathVariable("name") String name ) {
        QueryWrapper<MedicalTechnology> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("tech_type",type)
                .like("tech_name",name);
        List<MedicalTechnology> list = medicalTechnologyService.list(queryWrapper);
        return ResultBean.SUCCESS(list);
    }
}
